import time
import socket
import network
import ubinascii
from machine import Pin
from umqtt.simple import MQTTClient

def sub_cb(topic, msg)
    print(topic,msg)
    if(msg == b'on')
        LED.value(0)
    if(msg == b'off')
        LED.value(1)

if __name__ == __main__
    print(Esp8266)
    mqtt = MQTTClient(CLIENT_ID, SERVER, PORT)
    mqtt.set_callback(sub_cb)
    mqtt.connect()
    mqtt.subscribe(TOPIC)
    print(Connected to %s, subscribed to %s topic % (SERVER, TOPIC))
    try
        while True
            mqtt.wait_msg()
    finally
        mqtt.disconnect()